﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Aij1.BLL;
using Aij1.Model;
using Aij1.Utils;

namespace Aij1.Cms
{
    public partial class AdminLogin : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            S_Employee employee = AuthData.GetUserInfo(XpoSession, txtUserName.Text.Trim()) as S_Employee;

            //if (!CheckCodeCreater.IsValid("AdminLogin", txtCheckCode.Text.Trim()))
            //{
            //    e.Result = "验证码不符。";
            //    return;
            //}

            if (employee == null)
            {
                e.Result = "不存在此用户。";
                return;
            }
            else if (!employee.Password.Equals(CommOp.MD5(txtPassword.Text)))
            {
                e.Result = "密码不对。";
            }
            else
            {
                AuthData.SetCurrentUser(employee);
                e.Result = "";
            }
        }
    }
}